home *** CD-ROM | disk | FTP | other *** search
/ Aminet 48 / Aminet 48 (2002)(GTI - Schatztruhe)[!][Apr 2002].iso / Aminet / text / edit / vim60rt.lha / Vim / vim60 / syntax / uc.vim < prev    next >
Encoding:
Text File  |  2001-05-11  |  7.4 KB  |  179 lines

  1. " Vim syntax file
  2. " Language:    UnrealScript
  3. " Maintainer:    Mark Ferrell <major@chaoticdreams.org>
  4. " URL:        ftp://ftp.chaoticdreams.org/pub/ut/vim/uc.vim
  5. " Credits:    Based on the java.vim syntax file by Claudio Fleiner
  6. " Last change:    2001 May 10
  7.  
  8. " Please check :help uc.vim for comments on some of the options available.
  9.  
  10. " For version 5.x: Clear all syntax items
  11. " For version 6.x: Quit when a syntax file was already loaded
  12. if version < 600
  13.   syntax clear
  14. elseif exists("b:current_syntax")
  15.   finish
  16. endif
  17.  
  18. " some characters that cannot be in a UnrealScript program (outside a string)
  19. syn match ucError "[\\@`]"
  20. syn match ucError "<<<\|\.\.\|=>\|<>\|||=\|&&=\|[^-]->\|\*\/"
  21.  
  22. " we define it here so that included files can test for it
  23. if !exists("main_syntax")
  24.   let main_syntax='uc'
  25. endif
  26.  
  27. syntax case ignore
  28.  
  29. " keyword definitions
  30. syn keyword ucBranch          break continue
  31. syn keyword ucConditional     if else switch
  32. syn keyword ucRepeat          while for do foreach
  33. syn keyword ucBoolean         true false
  34. syn keyword ucConstant        null
  35. syn keyword ucOperator        new instanceof
  36. syn keyword ucType            boolean char byte short int long float double
  37. syn keyword ucType            void Pawn sound state auto exec function ipaddr
  38. syn keyword ucType          ELightType actor ammo defaultproperties bool
  39. syn keyword ucType          native noexport var out vector name local string
  40. syn keyword ucType          event
  41. syn keyword ucStatement       return
  42. syn keyword ucStorageClass    static synchronized transient volatile final
  43. syn keyword ucMethodDecl      synchronized throws
  44.  
  45. " UnrealScript defines classes in sorta fscked up fashion
  46. syn match   ucClassDecl       "^[Cc]lass[\s$]*\S*[\s$]*expands[\s$]*\S*;" contains=ucSpecial,ucSpecialChar,ucClassKeys
  47. syn keyword ucClassKeys          class expands extends
  48. syn match   ucExternal          "^\#exec.*" contains=ucCommentString,ucNumber
  49. syn keyword ucScopeDecl       public protected private abstract
  50.  
  51. " UnrealScript Functions
  52. syn match   ucFuncDef          "^.*function\s*[\(]*" contains=ucType,ucStorageClass
  53. syn match   ucEventDef          "^.*event\s*[\(]*" contains=ucType,ucStorageClass
  54. syn match   ucClassLabel      "[a-zA-Z0-9]*\'[a-zA-Z0-9]*\'" contains=ucCharacter
  55.  
  56. syn region  ucLabelRegion     transparent matchgroup=ucLabel start="\<case\>" matchgroup=NONE end=":" contains=ucNumber
  57. syn match   ucUserLabel       "^\s*[_$a-zA-Z][_$a-zA-Z0-9_]*\s*:"he=e-1 contains=ucLabel
  58. syn keyword ucLabel           default
  59.  
  60. " The following cluster contains all java groups except the contained ones
  61. syn cluster ucTop contains=ucExternal,ucError,ucError,ucBranch,ucLabelRegion,ucLabel,ucConditional,ucRepeat,ucBoolean,ucConstant,ucTypedef,ucOperator,ucType,ucType,ucStatement,ucStorageClass,ucMethodDecl,ucClassDecl,ucClassDecl,ucClassDecl,ucScopeDecl,ucError,ucError2,ucUserLabel,ucClassLabel
  62.  
  63. " Comments
  64. syn keyword ucTodo             contained TODO FIXME XXX
  65. syn region  ucCommentString    contained start=+"+ end=+"+ end=+\*/+me=s-1,he=s-1 contains=ucSpecial,ucCommentStar,ucSpecialChar
  66. syn region  ucComment2String   contained start=+"+  end=+$\|"+  contains=ucSpecial,ucSpecialChar
  67. syn match   ucCommentCharacter contained "'\\[^']\{1,6\}'" contains=ucSpecialChar
  68. syn match   ucCommentCharacter contained "'\\''" contains=ucSpecialChar
  69. syn match   ucCommentCharacter contained "'[^\\]'"
  70. syn region  ucComment          start="/\*"  end="\*/" contains=ucCommentString,ucCommentCharacter,ucNumber,ucTodo
  71. syn match   ucCommentStar      contained "^\s*\*[^/]"me=e-1
  72. syn match   ucCommentStar      contained "^\s*\*$"
  73. syn match   ucLineComment      "//.*" contains=ucComment2String,ucCommentCharacter,ucNumber,ucTodo
  74. hi link ucCommentString ucString
  75. hi link ucComment2String ucString
  76. hi link ucCommentCharacter ucCharacter
  77.  
  78. syn cluster ucTop add=ucComment,ucLineComment
  79.  
  80. " match the special comment /**/
  81. syn match   ucComment          "/\*\*/"
  82.  
  83. " Strings and constants
  84. syn match   ucSpecialError     contained "\\."
  85. "syn match   ucSpecialCharError contained "[^']"
  86. syn match   ucSpecialChar      contained "\\\([4-9]\d\|[0-3]\d\d\|[\"\\'ntbrf]\|u\x\{4\}\)"
  87. syn region  ucString           start=+"+ end=+"+  contains=ucSpecialChar,ucSpecialError
  88. syn match   ucStringError      +"\([^"\\]\|\\.\)*$+
  89. syn match   ucCharacter        "'[^']*'" contains=ucSpecialChar,ucSpecialCharError
  90. syn match   ucCharacter        "'\\''" contains=ucSpecialChar
  91. syn match   ucCharacter        "'[^\\]'"
  92. syn match   ucNumber           "\<\(0[0-7]*\|0[xX]\x\+\|\d\+\)[lL]\=\>"
  93. syn match   ucNumber           "\(\<\d\+\.\d*\|\.\d\+\)\([eE][-+]\=\d\+\)\=[fFdD]\="
  94. syn match   ucNumber           "\<\d\+[eE][-+]\=\d\+[fFdD]\=\>"
  95. syn match   ucNumber           "\<\d\+\([eE][-+]\=\d\+\)\=[fFdD]\>"
  96.  
  97. " unicode characters
  98. syn match   ucSpecial "\\u\d\{4\}"
  99.  
  100. syn cluster ucTop add=ucString,ucCharacter,ucNumber,ucSpecial,ucStringError
  101.  
  102. " catch errors caused by wrong parenthesis
  103. syn region  ucParen            transparent start="(" end=")" contains=@ucTop,ucParen
  104. syn match   ucParenError       ")"
  105. hi link     ucParenError       ucError
  106.  
  107. if !exists("uc_minlines")
  108.   let uc_minlines = 10
  109. endif
  110. exec "syn sync ccomment ucComment minlines=" . uc_minlines
  111.  
  112. " Define the default highlighting.
  113. " For version 5.7 and earlier: only when not done already
  114. " For version 5.8 and later: only when an item doesn't have highlighting yet
  115. if version >= 508 || !exists("did_uc_syntax_inits")
  116.   if version < 508
  117.     let did_uc_syntax_inits = 1
  118.     command -nargs=+ HiLink hi link <args>
  119.   else
  120.     command -nargs=+ HiLink hi def link <args>
  121.   endif
  122.  
  123.   HiLink ucFuncDef                       Conditional
  124.   HiLink ucEventDef                      Conditional
  125.   HiLink ucBraces                        Function
  126.   HiLink ucBranch                        Conditional
  127.   HiLink ucLabel                         Label
  128.   HiLink ucUserLabel                     Label
  129.   HiLink ucConditional                   Conditional
  130.   HiLink ucRepeat                        Repeat
  131.   HiLink ucStorageClass                  StorageClass
  132.   HiLink ucMethodDecl                    ucStorageClass
  133.   HiLink ucClassDecl                     ucStorageClass
  134.   HiLink ucScopeDecl                     ucStorageClass
  135.   HiLink ucBoolean                       Boolean
  136.   HiLink ucSpecial                       Special
  137.   HiLink ucSpecialError                  Error
  138.   HiLink ucSpecialCharError              Error
  139.   HiLink ucString                        String
  140.   HiLink ucCharacter                     Character
  141.   HiLink ucSpecialChar            SpecialChar
  142.   HiLink ucNumber                        Number
  143.   HiLink ucError                         Error
  144.   HiLink ucStringError                   Error
  145.   HiLink ucStatement                     Statement
  146.   HiLink ucOperator                      Operator
  147.   HiLink ucOverLoaded              Operator
  148.   HiLink ucComment                       Comment
  149.   HiLink ucDocComment                    Comment
  150.   HiLink ucLineComment                   Comment
  151.   HiLink ucConstant                ucBoolean
  152.   HiLink ucTypedef                Typedef
  153.   HiLink ucTodo                          Todo
  154.  
  155.   HiLink ucCommentTitle                  SpecialComment
  156.   HiLink ucDocTags                Special
  157.   HiLink ucDocParam                Function
  158.   HiLink ucCommentStar                   ucComment
  159.  
  160.   HiLink ucType                          Type
  161.   HiLink ucExternal                      Include
  162.  
  163.   HiLink ucClassKeys              Conditional
  164.   HiLink ucClassLabel              Conditional
  165.  
  166.   HiLink htmlComment                       Special
  167.   HiLink htmlCommentPart                   Special
  168.  
  169.   delcommand HiLink
  170. endif
  171.  
  172. let b:current_syntax = "uc"
  173.  
  174. if main_syntax == 'uc'
  175.   unlet main_syntax
  176. endif
  177.  
  178. " vim: ts=8
  179.